﻿using Css_VoteSys.Models.Database;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Css_VoteSys.Service
{
    public class CategoryService: ICategoryService
    {
        private readonly Css_VoteSysContext _db;

        public CategoryService(Css_VoteSysContext db)
        {
            _db = db;
        }

        /// <summary>
        /// 是否存在该项目类型
        /// </summary>
        /// <param name="CategoryId"></param>
        /// <returns></returns>
        public bool IsCategory(int CategoryId)
        {
            return _db.Categories.Any(x => x.CategoryId == CategoryId);
        }
    }
}
